package com.ss.android.article.browser.download;

import android.database.sqlite.SQLiteDatabase;
import android.support.annotation.Nullable;

import com.a.a.t;
import com.ss.android.article.browser.download.internal.DownloadDBHelper;
import com.ss.android.article.browser.download.internal.DownloadState;
import com.ss.android.article.browser.download.internal.DownloadTask;

import java.util.Iterator;
import java.util.List;

final class j extends t {
    private final DownloadTaskManager a;

    j(DownloadTaskManager arg1) {
        this.a = arg1;
    }

    public final void a(@Nullable Object arg9) {
        super.a(arg9);
        Iterator v1 = ((List) arg9).iterator();
        while (v1.hasNext()) {
            ((DownloadTask) v1.next()).downloadState = DownloadState.PAUSE;
        }

        SQLiteDatabase database = DownloadTaskManager.a(this.a).getWritableDatabase();
        database.beginTransaction();
        try {
            Iterator v2 = ((List) arg9).iterator();
            while (v2.hasNext()) {
                Object v0_1 = v2.next();
                database.update("download", DownloadDBHelper.toContentValues(((DownloadTask) v0_1)), "file_path=?", new String[]{((DownloadTask) v0_1).getFilePath()});
            }

            database.setTransactionSuccessful();
        } catch (Exception v0) {
        }

        database.endTransaction();
    }
}

